<template>
    <div class="dataMaintain-view">
        <div v-show="usershow==1" class="dataMaintain-view-user1">
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title">上级组织：</div>
                <div>
                    <el-input
                            v-model="distributorInfo.parentName"
                        class="dataMaintain-view-list-input"
                        :placeholder="distributorInfo.parentName?distributorInfo.parentName:'上级组织'"
                        :disabled="true"
                        clearable>
                 </el-input>
                </div>
            </div>
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title">组织名称：</div>
                <div>
                    <el-input
                            class="dataMaintain-view-list-input"
                            placeholder="请输入组织名称"
                            v-model="value1"
                            clearable>
                    </el-input>
                </div>
            </div>
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title">联系人：</div>
                <div>
                    <el-input
                            class="dataMaintain-view-list-input"
                            placeholder="请输入联系人"
                            v-model="value2"
                            clearable>
                    </el-input>
                </div>
            </div>
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title">联系电话：</div>
                <div>
                    <el-input
                            class="dataMaintain-view-list-input"
                            placeholder="请输入联系电话"
                            v-model="value3"
                            clearable>
                    </el-input>
                </div>
            </div>
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title">公司名称：</div>
                <div>
                    <el-input
                            class="dataMaintain-view-list-input"
                            placeholder="请输入公司名称"
                            v-model="value4"
                            clearable>
                    </el-input>
                </div>
            </div>
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title">公司地址：</div>
                <div>
                    <el-input
                            class="dataMaintain-view-list-input"
                            placeholder="请输入公司地址"
                            v-model="value5"
                            clearable>
                    </el-input>
                </div>
            </div>
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title">备注：</div>
                <div>
                    <el-input
                            class="dataMaintain-view-list-input1"
                            type="textarea"
                            placeholder="请输入备注"
                            v-model="value6">
                    </el-input>
                </div>
            </div>
            <div class="dataMaintain-view-list">
                <div class="dataMaintain-view-list-title"></div>
                <div>
                    <el-button  class="dataMaintain-view-list-button" type="primary" @click="preservation">保存</el-button>
                </div>
            </div>
        </div>
        <div v-show="usershow==2"  class="dataMaintain-view-user2">
            <setDataMaintain></setDataMaintain>
        </div>
    </div>
</template>

<script>
    import setDataMaintain from '../common/set/setDataMaintain';
    export default {
        name: "dataMaintain",
        data(){
            return{
                organizationId: this.$store.getters.userData.userMsg.id,//组织id
                distributorInfo:{},
                usershow:1,
                input1:"",
                value1:"",
                value2:"",
                value3:"",
                value4:"",
                value5:"",
                value6:"",
            }
        },
        components: {
            setDataMaintain
        },
        mounted(){
            this.getuserinfo()
        },
        methods: {
            preservation(){
                let _this = this;
                let params={
                    id:this.organizationId,//分销商id
                    name:this.value1,
                    post:this.value2,
                    contatctTel:this.value3,
                    company:this.value4,
                    companyAddress:this.value5,
                    remark:this.value6,
                }
                _this.Api.setting.distSaveDistributorInfo(params).then((data)=>{
                    if(data.returnCode==10000){
                        this.$message({
                            message: '修改成功',
                            type: 'success'
                        });
                    }else {
                        this.$message({
                            message: data.msg,
                            type: 'warning'
                        });
                    }
                })
            },
            getuserinfo(){
                let _this=this
                let params={
                    id:this.organizationId,//分销商id
                }
                _this.Api.setting.distSeeDistributorInfo(params).then((data)=>{
                    this.distributorInfo=data.data
                    if(data.data.parentId==0){
                        this.usershow=2
                    }else {
                        this.usershow=1
                    }
                    console.log(data,"?????????????????????")
                }).catch(() => {
                    this.$message.error('经纪人查看范围修改失败');
                });
            },
        }
    }
</script>

<style scoped rel="stylesheet/scss" lang="scss">
.dataMaintain-view{
  margin: 24px;
    background-color: #ffffff;
    .dataMaintain-view-user1{
        padding-bottom: 40px;
        .dataMaintain-view-list{
            display: flex;
            padding-top: 32px;
            .dataMaintain-view-list-title{
                font-size:14px;
                font-family:PingFangSC-Regular;
                font-weight:400;
                color:rgba(0,0,0,0.85);
                line-height:32px;
                min-width:70px;
                text-align: right;
                margin-left: 32px;
                margin-right: 5px;
            }
            .dataMaintain-view-list-input{
                width:468px;
                height:32px;
                background:rgba(255,255,255,1);
                border-radius:4px;
            }
            .dataMaintain-view-list-input1{
                width:468px;
                background:rgba(255,255,255,1);
                border-radius:4px;
            }
            .dataMaintain-view-list-button{
                width:468px;
                height:32px;
                background:rgba(24,144,255,1);
                border-radius:4px;
                font-size:14px;
                font-family:PingFangSC-Regular;
                font-weight:400;
                color:rgba(255,255,255,1);
            }
        }
    }
}
</style>